﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Shrestha.Trigraph
{
    public class TriClusterEvent : IComparable<TriClusterEvent>
    {
        public double MaxLat { get; private set; }
        public double MinLat { get; private set; }
        public double MaxLng { get; private set; }
        public double MinLng { get; private set; }
        public DateTime MaxDate { get; private set; }
        public DateTime MinDate { get; private set; }
        public int ClusterId { get; private set; }
        public int ZoomLvl { get; private set; }

        public TriClusterEvent(double MaxLat, double MinLat, double MaxLng, double MinLng, DateTime MaxDate, DateTime MinDate, int cluster_id, int zoomlvl)
        {
            this.MaxLat = MaxLat;
            this.MinLat = MinLat;
            this.MaxLng = MaxLng;
            this.MinLng = MinLng;
            this.MaxDate = MaxDate;
            this.MinDate = MinDate;
            this.ClusterId = cluster_id;
            this.ZoomLvl = zoomlvl;
        }

        public TriEvent MaxEvent { get { return new TriEvent(MaxLat, MaxLng, MaxDate); } }
        public TriEvent MinEvent { get { return new TriEvent(MinLat, MinLng); } }
        public TriEvent AvgEvent { get { return new TriEvent((MaxLat + MinLat) / 2, (MaxLng + MinLng) / 2); } }

        public int CompareTo(TriClusterEvent other)
        {
            if (MaxLat == other.MaxLat && 
                MaxLng == other.MaxLng && 
                MaxDate == other.MaxDate && 
                MinLat == other.MinLat && 
                MinLng == other.MinLng && 
                MinDate == other.MinDate &&
                ClusterId == other.ClusterId && 
                ZoomLvl == other.ZoomLvl) 
                return 0;
            else return 1;
        }
    }
}
